package com.ssy.lingxi.contract.serviceimpl;

import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.contract.model.constant.ApplyAmountOrderStatusEnum;
import com.ssy.lingxi.contract.model.constant.ContractOuterStatusEnum;
import com.ssy.lingxi.contract.model.constant.ContractPartyAInnerStatusEnum;
import com.ssy.lingxi.contract.model.constant.ContractPartyBInnerStatusEnum;
import com.ssy.lingxi.contract.model.vo.common.response.StatusVO;
import com.ssy.lingxi.contract.service.IStatusService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 *  合同服务下-状态查询impl
 * @author ds
 * @date 2021/5/28
 * @version 2.0.0
 */
@Service
@Slf4j
public class StatusServiceImpl implements IStatusService {

    public static List<Integer> toList(Integer excludeCode){
        return Stream.of(excludeCode).collect(Collectors.toList());
    }

    @Override
    public Wrapper<StatusVO> getStatusByContractManage() {
        StatusVO instance = StatusVO.getInstance();
        instance.setOuterList(ContractOuterStatusEnum.all(null));
        instance.setInnerList(ContractPartyAInnerStatusEnum.all(null));
        return Wrapper.success(instance);
    }

    @Override
    public Wrapper<StatusVO> getStatusByContractCoordination() {
        StatusVO instance = StatusVO.getInstance();
        instance.setOuterList(ContractOuterStatusEnum.all(null));
        instance.setInnerList(ContractPartyBInnerStatusEnum.all(null));
        return Wrapper.success(instance);
    }

    @Override
    public Wrapper<StatusVO> getStatusByApplyAmountOrder() {
        StatusVO instance = StatusVO.getInstance();
        instance.setInnerList(ApplyAmountOrderStatusEnum.all(null));
        return Wrapper.success(instance);
    }

    @Override
    public Wrapper<StatusVO> getStatusByContractExecute() {
        StatusVO instance = StatusVO.getInstance();
        instance.setOuterList(ContractOuterStatusEnum.executeStatusList());
        return Wrapper.success(instance);
    }
}
